{% extends 'user.html' %}

{% block edit_form %}

{% if perms.auth.change_user or user_id == user.id %}
{% if reader.is_active %}
  <p>This user is active</p>
{% else %}
  <p class="unavailable">This user is inactive</p>
{% endif %}  

	<div class="profile_editWrapper">
	  <h2 id="edit">Edit profile</h2>
	    {% if display_tips %}
	    <div class="tip">
	      <ol>
	        <li><p>To remove chosen phone make it's value empty.</p></li>
	        <li><p>To change any part of your data, password is required. Make sure you typed it.</p></li>
	        <li><p>If new password input is left empty, password will not be changed.</p></li>
	        <li><p>To change username, contact with administrator.</p></li>
	      </ol>
	    </div>
	    {% endif %}

            <center>
	    <div>
	        <div class="content_form" style="margin-top: 1em">
	            <form action="." method="POST" class="edit_profile" name="Freg">
	                {{ form_content.non_field_errors }}
	                <table>
                      <tr>
                        <td class="first">
                            <table>
                            {% for field in form_content %}
                                {% if "Phone" not in field.label_tag  and "Value" not in field.label_tag %}
                                <tr>
                                    <td>{%if field.label_tag|removetags:"label" %}{{ field.label_tag }}:{%endif%}</td>
                                    <td>{{ field }} {{ field.errors }}</td>
                                </tr>
                                {% endif %}
                            {% endfor %}
                            </table>
                        </td>
                        <td class="second">
                            <table>
                            {% for field in form_content %}
                                {% if "Phone" in field.label_tag  or "Value" in field.label_tag %}
                                <tr>
                                    <td>{%if field.label_tag|removetags:"label" %}{{ field.label_tag }}:{%endif%}</td>
                                    <td>{{ field }} {{ field.errors }}</td>
                                </tr>
                                {%endif%}
                            {% endfor %}
                            </table>
                            </td>
                      </tr>
                      <tr>
                        <td colspan="2">
                            <input type="submit" value="Update profile">
                        </td>
                      </tr>
                    </table>
	            </form>

				<script type="text/javascript">
					document.Freg.username.focus();
				</script>
		
	        </div>
	        <b>{{ edit_info }}</b>
	    </div>
            </center>
	</div>
	
{% endif %} <!-- has edit perms -->

{% endblock %}
